import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home.vue'
import IndexView from '../views/IndexView.vue'
import UserView from '../views/UserView.vue'
import BookView from '@/views/BookView.vue'
import BookDetailsView from '@/views/BookDetailsView.vue'
import LoginView from '@/views/LoginView.vue'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
        path: '/',
        name: 'home',
        component: Home,
        redirect: '/index',
        children:[{
          
          path: '/index',
          name: 'index',
          component: IndexView,

      },
      {
            path: '/user',
            name: 'user',
            component: UserView,

        }
        ,
        {
              path: '/book',
              name: 'book',
              component: BookView,
              children:[
                {
                  path: '/book/detail',
                  name: 'bookDetail',
                  component: BookDetailsView
                }

              ]

    
          }
      
      ],
    },
    {
      path: '/login',
      name: 'login',
      component: LoginView

    }


  ],
})

export default router
